package com.tianzhu.domain;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import com.fasterxml.jackson.annotation.JsonIgnore;


/**
 * The persistent class for the CARTITEM database table.
 * 
 */
@Entity
@Table(name="CARTITEM")
@NamedQuery(name="Cartitem.findAll", query="SELECT c FROM Cartitem c")
public class Cartitem implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="CARTITEM_CARTITEMID_GENERATOR", sequenceName="CARTITEM_S")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="CARTITEM_CARTITEMID_GENERATOR")
	@Column(unique=true, nullable=false, precision=38)
	private Long cartitemid;

	
	@ManyToOne
    @JoinColumn(name = "CARTID")
    @JsonIgnore
    private Cart cart;

    @ManyToOne
    @JoinColumn(name = "PRODUCTID")
    private Product product;

	@Column(name="QUANTITY",precision=38)
	private Long quantity;

	@Column(name="TOTALPRICE",precision=126)
	private double totalprice;

	public Cartitem() {
	}

	public Long getCartitemid() {
		return this.cartitemid;
	}

	public void setCartitemid(Long cartitemid) {
		this.cartitemid = cartitemid;
	}

	

	public Long getQuantity() {
		return this.quantity;
	}

	public void setQuantity(Long quantity) {
		this.quantity = quantity;
	}

	public double getTotalprice() {
		return this.totalprice;
	}

	public void setTotalprice(double totalprice) {
		this.totalprice = totalprice;
	}
	
	public Cart getCart() {
        return cart;
    }

    public void setCart(Cart cart) {
        this.cart = cart;
    }

    public Product getProduct() {
        return product;
    }

    public void setProduct(Product product) {
        this.product = product;
    }

}